package bairui.international.model.domain.jpa;

import com.lianjing.sh.model.uml.model.data.TBSuper_BaseIDAndTimeAndOrderValue;

/**
 *
 * (分公司员工金额记录)TB_BranchCompanyStaffMoneyRecord
 *
 * @说明
 * <pre>

 * </pre>
 *
 * @see Help_TB_BranchCompanyStaffMoneyRecord#inheritance() 继承体系信息
 *
 */
@org.hibernate.annotations.DynamicInsert
@org.hibernate.annotations.DynamicUpdate

@javax.persistence.Entity(name="t_branchCompanyStaffMoneyRecord")
@com.lianjing.sh.processing.info.annotation.GenerateInfoModel
@SuppressWarnings("serial")
@com.lianjing.sh.model.common.annotation.Comment("分公司员工金额记录")
@com.lianjing.sh.processing.info.annotation.InfoComment("分公司员工金额记录")
public class TB_BranchCompanyStaffMoneyRecord
 extends TBSuper_BaseIDAndTimeAndOrderValue
 implements 
	com.lianjing.sh.model.common.stardard.TableModel<Long>,
	java.io.Serializable

{

	
	
	/**
	 * 必须属性赋值接口
	 */
	public static interface MustProperties{
		/** 金额 */
		public Double getMoney();
		/** 剩余金额 */
		public Double getCurrentMoney();
		/** 类型 */
		public bairui.international.model.type.Type_BranchCompanyStaffMoneyRecord getType();
		/** 分公司员工 */
		public bairui.international.model.domain.jpa.TB_BranchCompanyStaff getBranchCompanyStaff();
		/** 剩余可提现总金额 */
		public Double getCurrentWithdrawMoney();
	}
	
	/**
	 * 为必须属性赋值
	 */
	public TB_BranchCompanyStaffMoneyRecord properties(MustProperties properties) {
		this.setMoney(properties.getMoney());
		this.setCurrentMoney(properties.getCurrentMoney());
		this.setType(properties.getType());
		this.setBranchCompanyStaff(properties.getBranchCompanyStaff());
		this.setCurrentWithdrawMoney(properties.getCurrentWithdrawMoney());
		return this;
	}
	
	/**
	 *	必须属性构造函数
	 */
	public TB_BranchCompanyStaffMoneyRecord(MustProperties properties) {
		this.properties(properties);
	}
	
	
	/**
	 * 可选单属性赋值接口
	 */
	public static interface OptionalSingleProperties{
		/** 分公司员工提成记录 */
		public bairui.international.model.domain.jpa.TB_BranchCompanyStaffRoyaltyRecord getBranchCompanyStaffRoyaltyRecord();
		/** 分公司员工提现单 */
		public bairui.international.model.domain.jpa.TB_BranchCompanyStaffWithdrawOrder getBranchCompanyStaffWithdrawOrder();
	}
	
	/**
	 * 为可选单属性赋值
	 */
	public TB_BranchCompanyStaffMoneyRecord properties(OptionalSingleProperties properties) {
		this.setBranchCompanyStaffRoyaltyRecord(properties.getBranchCompanyStaffRoyaltyRecord());
		this.setBranchCompanyStaffWithdrawOrder(properties.getBranchCompanyStaffWithdrawOrder());
		return this;
	}
	
	
	
	public TB_BranchCompanyStaffMoneyRecord(MustProperties must, OptionalSingleProperties optionalSingle) {
		this.properties(must);
		this.properties(optionalSingle);
	}
	
	/**
	 * 仅当前必须属性赋值接口
	 */
	public static interface CurrentMustProperties{
		/** 金额 */
		public Double getMoney();
		/** 剩余金额 */
		public Double getCurrentMoney();
		/** 类型 */
		public bairui.international.model.type.Type_BranchCompanyStaffMoneyRecord getType();
		/** 分公司员工 */
		public bairui.international.model.domain.jpa.TB_BranchCompanyStaff getBranchCompanyStaff();
		/** 剩余可提现总金额 */
		public Double getCurrentWithdrawMoney();
	}
	
	/**
	 * 为仅当前必须属性赋值
	 */
	public TB_BranchCompanyStaffMoneyRecord properties(CurrentMustProperties properties) {
		this.setMoney(properties.getMoney());
		this.setCurrentMoney(properties.getCurrentMoney());
		this.setType(properties.getType());
		this.setBranchCompanyStaff(properties.getBranchCompanyStaff());
		this.setCurrentWithdrawMoney(properties.getCurrentWithdrawMoney());
		return this;
	}
	
	/**
	 * 仅当前可选单属性赋值接口
	 */
	public static interface CurrentOptionalSingleProperties{
		/** 分公司员工提成记录 */
		public bairui.international.model.domain.jpa.TB_BranchCompanyStaffRoyaltyRecord getBranchCompanyStaffRoyaltyRecord();
		/** 分公司员工提现单 */
		public bairui.international.model.domain.jpa.TB_BranchCompanyStaffWithdrawOrder getBranchCompanyStaffWithdrawOrder();
	}
	
	/**
	 * 为仅当前可选单属性赋值
	 */
	public TB_BranchCompanyStaffMoneyRecord properties(CurrentOptionalSingleProperties properties) {
		this.setBranchCompanyStaffRoyaltyRecord(properties.getBranchCompanyStaffRoyaltyRecord());
		this.setBranchCompanyStaffWithdrawOrder(properties.getBranchCompanyStaffWithdrawOrder());
		return this;
	}
	
	public TB_BranchCompanyStaffMoneyRecord(
		@lombok.NonNull com.lianjing.sh.model.uml.model.data.TBSuper_BaseIDAndTimeAndOrderValue bean,
		CurrentMustProperties mustProperties,
		CurrentOptionalSingleProperties optionalProperties
	) {
		this(bean);
		this.properties(mustProperties);
		this.properties(optionalProperties);
	}
	
	public TB_BranchCompanyStaffMoneyRecord(
		@lombok.NonNull com.lianjing.sh.model.uml.model.data.TBSuper_BaseIDAndTimeAndOrderValue bean
	) {
		update(bean);
	}
	
	public TB_BranchCompanyStaffMoneyRecord update(com.lianjing.sh.model.uml.model.data.TBSuper_BaseIDAndTimeAndOrderValue bean){
		this.setId(bean.getId());
		this.setCreateTime(bean.getCreateTime());
		this.setModifyTime(bean.getModifyTime());
		this.setOrderValue(bean.getOrderValue());
		return this;
	}
	
	
	/**
	 * 更新属性内部类
	 */
	public abstract class UpdateProperties {
	
		public UpdateProperties() throws Exception {
			Integer orderValue = getOrderValue(TB_BranchCompanyStaffMoneyRecord.this);
			if(isOverride_getOrderValue){
				TB_BranchCompanyStaffMoneyRecord.this.setOrderValue(orderValue);
			}
	
			Double money = getMoney(TB_BranchCompanyStaffMoneyRecord.this);
			if(isOverride_getMoney){
				TB_BranchCompanyStaffMoneyRecord.this.setMoney(money);
			}
	
			Double currentMoney = getCurrentMoney(TB_BranchCompanyStaffMoneyRecord.this);
			if(isOverride_getCurrentMoney){
				TB_BranchCompanyStaffMoneyRecord.this.setCurrentMoney(currentMoney);
			}
	
			bairui.international.model.type.Type_BranchCompanyStaffMoneyRecord type = getType(TB_BranchCompanyStaffMoneyRecord.this);
			if(isOverride_getType){
				TB_BranchCompanyStaffMoneyRecord.this.setType(type);
			}
	
			bairui.international.model.domain.jpa.TB_BranchCompanyStaffRoyaltyRecord branchCompanyStaffRoyaltyRecord = getBranchCompanyStaffRoyaltyRecord(TB_BranchCompanyStaffMoneyRecord.this);
			if(isOverride_getBranchCompanyStaffRoyaltyRecord){
				TB_BranchCompanyStaffMoneyRecord.this.setBranchCompanyStaffRoyaltyRecord(branchCompanyStaffRoyaltyRecord);
			}
	
			bairui.international.model.domain.jpa.TB_BranchCompanyStaffWithdrawOrder branchCompanyStaffWithdrawOrder = getBranchCompanyStaffWithdrawOrder(TB_BranchCompanyStaffMoneyRecord.this);
			if(isOverride_getBranchCompanyStaffWithdrawOrder){
				TB_BranchCompanyStaffMoneyRecord.this.setBranchCompanyStaffWithdrawOrder(branchCompanyStaffWithdrawOrder);
			}
	
			bairui.international.model.domain.jpa.TB_BranchCompanyStaff branchCompanyStaff = getBranchCompanyStaff(TB_BranchCompanyStaffMoneyRecord.this);
			if(isOverride_getBranchCompanyStaff){
				TB_BranchCompanyStaffMoneyRecord.this.setBranchCompanyStaff(branchCompanyStaff);
			}
	
			Double currentWithdrawMoney = getCurrentWithdrawMoney(TB_BranchCompanyStaffMoneyRecord.this);
			if(isOverride_getCurrentWithdrawMoney){
				TB_BranchCompanyStaffMoneyRecord.this.setCurrentWithdrawMoney(currentWithdrawMoney);
			}
		}
	
		public TB_BranchCompanyStaffMoneyRecord up(){
			return TB_BranchCompanyStaffMoneyRecord.this;
		}
	
		/** 排序值 */
		private boolean isOverride_getOrderValue = true;
		public Integer getOrderValue(TB_BranchCompanyStaffMoneyRecord it) throws Exception { 
			isOverride_getOrderValue = false; 
			return null;
		}
		/** 金额 */
		private boolean isOverride_getMoney = true;
		public Double getMoney(TB_BranchCompanyStaffMoneyRecord it) throws Exception { 
			isOverride_getMoney = false; 
			return null;
		}
		/** 剩余金额 */
		private boolean isOverride_getCurrentMoney = true;
		public Double getCurrentMoney(TB_BranchCompanyStaffMoneyRecord it) throws Exception { 
			isOverride_getCurrentMoney = false; 
			return null;
		}
		/** 类型 */
		private boolean isOverride_getType = true;
		public bairui.international.model.type.Type_BranchCompanyStaffMoneyRecord getType(TB_BranchCompanyStaffMoneyRecord it) throws Exception { 
			isOverride_getType = false; 
			return null;
		}
		/** 分公司员工提成记录 */
		private boolean isOverride_getBranchCompanyStaffRoyaltyRecord = true;
		public bairui.international.model.domain.jpa.TB_BranchCompanyStaffRoyaltyRecord getBranchCompanyStaffRoyaltyRecord(TB_BranchCompanyStaffMoneyRecord it) throws Exception { 
			isOverride_getBranchCompanyStaffRoyaltyRecord = false; 
			return null;
		}
		/** 分公司员工提现单 */
		private boolean isOverride_getBranchCompanyStaffWithdrawOrder = true;
		public bairui.international.model.domain.jpa.TB_BranchCompanyStaffWithdrawOrder getBranchCompanyStaffWithdrawOrder(TB_BranchCompanyStaffMoneyRecord it) throws Exception { 
			isOverride_getBranchCompanyStaffWithdrawOrder = false; 
			return null;
		}
		/** 分公司员工 */
		private boolean isOverride_getBranchCompanyStaff = true;
		public bairui.international.model.domain.jpa.TB_BranchCompanyStaff getBranchCompanyStaff(TB_BranchCompanyStaffMoneyRecord it) throws Exception { 
			isOverride_getBranchCompanyStaff = false; 
			return null;
		}
		/** 剩余可提现总金额 */
		private boolean isOverride_getCurrentWithdrawMoney = true;
		public Double getCurrentWithdrawMoney(TB_BranchCompanyStaffMoneyRecord it) throws Exception { 
			isOverride_getCurrentWithdrawMoney = false; 
			return null;
		}
	
	}
	
	
	/**
	 * 构造函数
	 */
	public TB_BranchCompanyStaffMoneyRecord() {
	}
	
	public TB_BranchCompanyStaffMoneyRecord(
		@lombok.NonNull Long id
	) {
		this.setId(id);
	}
	
	public TB_BranchCompanyStaffMoneyRecord(
		@lombok.NonNull TB_BranchCompanyStaffMoneyRecord bean
	) {
		this.setId(bean.getId());
		this.setCreateTime(bean.getCreateTime());
		this.setModifyTime(bean.getModifyTime());
		this.setOrderValue(bean.getOrderValue());
		this.setMoney(bean.getMoney());
		this.setCurrentMoney(bean.getCurrentMoney());
		this.setType(bean.getType());
		this.setBranchCompanyStaffRoyaltyRecord(bean.getBranchCompanyStaffRoyaltyRecord());
		this.setBranchCompanyStaffWithdrawOrder(bean.getBranchCompanyStaffWithdrawOrder());
		this.setBranchCompanyStaff(bean.getBranchCompanyStaff());
		this.setCurrentWithdrawMoney(bean.getCurrentWithdrawMoney());
	}
	
	

	


	/**
	 * 属性
	 */
	@com.lianjing.sh.model.common.annotation.Comment("金额")
	@com.lianjing.sh.processing.info.annotation.InfoComment("金额")
	@javax.persistence.Column(name="money", nullable=false)
	private Double money;

	@com.lianjing.sh.model.common.annotation.Comment("剩余金额")
	@com.lianjing.sh.processing.info.annotation.InfoComment("剩余金额")
	@javax.persistence.Column(name="currentMoney", nullable=false)
	private Double currentMoney;

	@com.lianjing.sh.model.common.annotation.Comment("类型")
	@com.lianjing.sh.processing.info.annotation.InfoComment("类型")
	@javax.persistence.Enumerated(javax.persistence.EnumType.STRING)
	@javax.persistence.Column(name="type", nullable=false)
	private bairui.international.model.type.Type_BranchCompanyStaffMoneyRecord type;

	@com.lianjing.sh.model.common.annotation.Comment("分公司员工提成记录")
	@com.lianjing.sh.processing.info.annotation.InfoComment("分公司员工提成记录")
	@com.querydsl.core.annotations.QueryInit("*.*.*")
	@javax.persistence.OneToOne()
	private bairui.international.model.domain.jpa.TB_BranchCompanyStaffRoyaltyRecord branchCompanyStaffRoyaltyRecord;

	@com.lianjing.sh.model.common.annotation.Comment("分公司员工提现单")
	@com.lianjing.sh.processing.info.annotation.InfoComment("分公司员工提现单")
	@com.querydsl.core.annotations.QueryInit("*.*.*")
	@javax.persistence.ManyToOne()
	private bairui.international.model.domain.jpa.TB_BranchCompanyStaffWithdrawOrder branchCompanyStaffWithdrawOrder;

	@com.lianjing.sh.model.common.annotation.Comment("分公司员工")
	@com.lianjing.sh.processing.info.annotation.InfoComment("分公司员工")
	@com.querydsl.core.annotations.QueryInit("*.*.*")
	@javax.persistence.ManyToOne(optional=false)
	private bairui.international.model.domain.jpa.TB_BranchCompanyStaff branchCompanyStaff;

	@com.lianjing.sh.model.common.annotation.Comment("剩余可提现总金额")
	@com.lianjing.sh.processing.info.annotation.InfoComment("剩余可提现总金额")
	@javax.persistence.Column(name="currentWithdrawMoney", nullable=false)
	private Double currentWithdrawMoney;

	/** get[金额] */
	public Double getMoney() {
		return this.money;
	}

	/** get[剩余金额] */
	public Double getCurrentMoney() {
		return this.currentMoney;
	}

	/** get[类型] */
	public bairui.international.model.type.Type_BranchCompanyStaffMoneyRecord getType() {
		return this.type;
	}

	/** get[分公司员工提成记录] */
	public bairui.international.model.domain.jpa.TB_BranchCompanyStaffRoyaltyRecord getBranchCompanyStaffRoyaltyRecord() {
		return this.branchCompanyStaffRoyaltyRecord;
	}

	/** get[分公司员工提现单] */
	public bairui.international.model.domain.jpa.TB_BranchCompanyStaffWithdrawOrder getBranchCompanyStaffWithdrawOrder() {
		return this.branchCompanyStaffWithdrawOrder;
	}

	/** get[分公司员工] */
	public bairui.international.model.domain.jpa.TB_BranchCompanyStaff getBranchCompanyStaff() {
		return this.branchCompanyStaff;
	}

	/** get[剩余可提现总金额] */
	public Double getCurrentWithdrawMoney() {
		return this.currentWithdrawMoney;
	}

	/** set[金额] */
	public void setMoney(Double money) {
		this.money = money;
	}

	/** set[剩余金额] */
	public void setCurrentMoney(Double currentMoney) {
		this.currentMoney = currentMoney;
	}

	/** set[类型] */
	public void setType(bairui.international.model.type.Type_BranchCompanyStaffMoneyRecord type) {
		this.type = type;
	}

	/** set[分公司员工提成记录] */
	public void setBranchCompanyStaffRoyaltyRecord(bairui.international.model.domain.jpa.TB_BranchCompanyStaffRoyaltyRecord branchCompanyStaffRoyaltyRecord) {
		this.branchCompanyStaffRoyaltyRecord = branchCompanyStaffRoyaltyRecord;
	}

	/** set[分公司员工提现单] */
	public void setBranchCompanyStaffWithdrawOrder(bairui.international.model.domain.jpa.TB_BranchCompanyStaffWithdrawOrder branchCompanyStaffWithdrawOrder) {
		this.branchCompanyStaffWithdrawOrder = branchCompanyStaffWithdrawOrder;
	}

	/** set[分公司员工] */
	public void setBranchCompanyStaff(bairui.international.model.domain.jpa.TB_BranchCompanyStaff branchCompanyStaff) {
		this.branchCompanyStaff = branchCompanyStaff;
	}

	/** set[剩余可提现总金额] */
	public void setCurrentWithdrawMoney(Double currentWithdrawMoney) {
		this.currentWithdrawMoney = currentWithdrawMoney;
	}

	public void assignBranchCompanyStaffRoyaltyRecord(bairui.international.model.domain.jpa.TB_BranchCompanyStaffRoyaltyRecord branchCompanyStaffRoyaltyRecord) {
		if(null != branchCompanyStaffRoyaltyRecord){
			branchCompanyStaffRoyaltyRecord.setBranchCompanyStaffMoneyRecord(this);
		}
		this.setBranchCompanyStaffRoyaltyRecord(branchCompanyStaffRoyaltyRecord);
	}
	

	public void assignBranchCompanyStaffWithdrawOrder(bairui.international.model.domain.jpa.TB_BranchCompanyStaffWithdrawOrder branchCompanyStaffWithdrawOrder) {
		if(null != branchCompanyStaffWithdrawOrder){
			branchCompanyStaffWithdrawOrder.addBranchCompanyStaffMoneyRecords(this);
		}
		this.setBranchCompanyStaffWithdrawOrder(branchCompanyStaffWithdrawOrder);
	}
	

	public void assignBranchCompanyStaff(bairui.international.model.domain.jpa.TB_BranchCompanyStaff branchCompanyStaff) {
		if(null != branchCompanyStaff){
			branchCompanyStaff.addBranchCompanyStaffMoneyRecords(this);
		}
		this.setBranchCompanyStaff(branchCompanyStaff);
	}
	

	
	
	

	/** take[分公司员工提成记录] */
	public bairui.international.model.domain.jpa.TB_BranchCompanyStaffRoyaltyRecord takeBranchCompanyStaffRoyaltyRecord(){
		if(null == this.branchCompanyStaffRoyaltyRecord){
			this.branchCompanyStaffRoyaltyRecord = new bairui.international.model.domain.jpa.TB_BranchCompanyStaffRoyaltyRecord();
		}
		return this.branchCompanyStaffRoyaltyRecord;
	}
	
	/** take[分公司员工提现单] */
	public bairui.international.model.domain.jpa.TB_BranchCompanyStaffWithdrawOrder takeBranchCompanyStaffWithdrawOrder(){
		if(null == this.branchCompanyStaffWithdrawOrder){
			this.branchCompanyStaffWithdrawOrder = new bairui.international.model.domain.jpa.TB_BranchCompanyStaffWithdrawOrder();
		}
		return this.branchCompanyStaffWithdrawOrder;
	}
	
	/** take[分公司员工] */
	public bairui.international.model.domain.jpa.TB_BranchCompanyStaff takeBranchCompanyStaff(){
		if(null == this.branchCompanyStaff){
			this.branchCompanyStaff = new bairui.international.model.domain.jpa.TB_BranchCompanyStaff();
		}
		return this.branchCompanyStaff;
	}
	
	/** must[分公司员工] */
	public bairui.international.model.domain.jpa.TB_BranchCompanyStaff mustBranchCompanyStaff() {
		return this.branchCompanyStaff;
	}
	
	/** optional[分公司员工提成记录] */
	public java.util.Optional<bairui.international.model.domain.jpa.TB_BranchCompanyStaffRoyaltyRecord> optionalBranchCompanyStaffRoyaltyRecord() {
		return java.util.Optional.ofNullable(this.branchCompanyStaffRoyaltyRecord);
	}
	
	/** optional[分公司员工提现单] */
	public java.util.Optional<bairui.international.model.domain.jpa.TB_BranchCompanyStaffWithdrawOrder> optionalBranchCompanyStaffWithdrawOrder() {
		return java.util.Optional.ofNullable(this.branchCompanyStaffWithdrawOrder);
	}
	

	/**
	 * 复写 hashCode
	 */
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		return prime * result + ((this.getId() == null) ? 0 : this.getId().hashCode());
	}
	
	/**
	 * 复写 equals
	 */
	@Override
	public boolean equals(Object obj) {
		if (this == obj){
			return true;
		}
		if (obj == null){
			return false;
		}
		if (getClass() != obj.getClass()){
			return false;
		}
		TB_BranchCompanyStaffMoneyRecord other = (TB_BranchCompanyStaffMoneyRecord) obj;
		if (this.getId() == null) {
			return false;
		} else if (!this.getId().equals(other.getId())){
			return false;
		}
		return true;
	}
	

	/**
	 * 用来覆盖toString()的输出
	 */
	@javax.persistence.Transient
	private String toString;
	
	public void setToString(String toString) {
		this.toString = toString;
	}
	
	/**
	 * 复写 toString
	 */
	@Override
	public String toString() {
		if(null != this.toString){
			return this.toString;
		}
		return super.toString();
	}	

	@javax.persistence.PrePersist
	public void prePersist() {
		this.setCreateTime(new java.util.Date());
		this.setModifyTime(new java.util.Date());
	}
	
	@javax.persistence.PreUpdate
	public void preUpdate() {
		this.setModifyTime(new java.util.Date());
	}



}
